package com.itheima.io.bufferedinputstream.demo02;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class BufferedInputStreamDemo01 {

    public static void main(String[] args) throws IOException {

        // 创建BufferedInputStream对象
        // public BufferedInputStream(InputStream in)
        // FileInputStream fileInputStream = new FileInputStream("itheima-io-bufferedinputstream\\b.txt") ;
        // BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("itheima-io-bufferedinputstream\\b.txt"));

        // 读取数据
        int by = bufferedInputStream.read() ;           // 返回值代表的就是读取到的字节
        System.out.println((char)by);

        by = bufferedInputStream.read() ;           // 返回值代表的就是读取到的字节
        System.out.println((char)by);

        // 释放资源
        bufferedInputStream.close();

    }
}
